import 'package:json_annotation/json_annotation.dart';

import '../item_style.dart';
import '../line_style.dart';
import '../tooltip.dart';
import 'series.dart';

part 'lines_series.g.dart';

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class Effect {
  var show;
  var period;
  var delay;
  var constantSpeed;
  var symbol;
  var symbolSize;
  var color;
  var trailLength;
  var loop;

  Effect(
      {this.show,
      this.period,
      this.delay,
      this.constantSpeed,
      this.symbol,
      this.symbolSize,
      this.color,
      this.trailLength,
      this.loop});

  factory Effect.fromJson(Map<String, dynamic> json) => _$EffectFromJson(json);

  Map<String, dynamic> toJson() => _$EffectToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class LinesEmphasis {
  var focus;
  var blurScope;

  LineStyle? lineStyle;
  SeriesLabel? label;

  LinesEmphasis({this.focus, this.blurScope, this.lineStyle, this.label});

  factory LinesEmphasis.fromJson(Map<String, dynamic> json) =>
      _$LinesEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$LinesEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class LinesBlurSelectEmphasis {
  LineStyle? lineStyle;
  SeriesLabel? label;

  LinesBlurSelectEmphasis({this.lineStyle, this.label});

  factory LinesBlurSelectEmphasis.fromJson(Map<String, dynamic> json) =>
      _$LinesBlurSelectEmphasisFromJson(json);

  Map<String, dynamic> toJson() => _$LinesBlurSelectEmphasisToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class LinesData {
  var name;

  var value;
  ItemStyle? itemStyle;

  LinesBlurSelectEmphasis? emphasis;
  LinesBlurSelectEmphasis? blur;
  LinesBlurSelectEmphasis? select;

  Tooltip? tooltip;

  LinesData(
      {this.name,
      this.value,
      this.itemStyle,
      this.emphasis,
      this.blur,
      this.select,
      this.tooltip});

  factory LinesData.fromJson(Map<String, dynamic> json) =>
      _$LinesDataFromJson(json);

  Map<String, dynamic> toJson() => _$LinesDataToJson(this);
}

@JsonSerializable(includeIfNull: false, explicitToJson: true)
class LinesSeries {
  var type = 'lines';
  var id;

  var name;

  var coordinateSystem;
  var xAxisIndex;
  var yAxisIndex;
  var geoIndex;
  var polyline;
  Effect? effect;

  var large;
  var largeThreshold;
  var symbol;
  var symbolSize;
  LineStyle? lineStyle;
  SeriesLabel? label;
  LabelLayout? labelLayout;

  LinesEmphasis? emphasis;

  LinesBlurSelectEmphasis? blur;

  LinesBlurSelectEmphasis? select;

  var selectedMode;
  var progressive;
  var progressiveThreshold;

  List<LinesData>? data;

  MarkPoint? markPoint;
  MarkLine? markLine;
  MarkArea? markArea;

  var clip;
  var zlevel;
  var z;
  var silent;
  var animation;
  var animationThreshold;
  var animationDuration;
  var animationEasing;
  var animationDelay;
  var animationDurationUpdate;
  var animationEasingUpdate;
  var animationDelayUpdate;

  LinesSeries(
      {this.id,
      this.name,
      this.coordinateSystem,
      this.xAxisIndex,
      this.yAxisIndex,
      this.geoIndex,
      this.polyline,
      this.effect,
      this.large,
      this.largeThreshold,
      this.symbol,
      this.symbolSize,
      this.lineStyle,
      this.label,
      this.labelLayout,
      this.emphasis,
      this.blur,
      this.select,
      this.selectedMode,
      this.progressive,
      this.progressiveThreshold,
      this.data,
      this.markPoint,
      this.markLine,
      this.markArea,
      this.clip,
      this.zlevel,
      this.z,
      this.silent,
      this.animation,
      this.animationThreshold,
      this.animationDuration,
      this.animationEasing,
      this.animationDelay,
      this.animationDurationUpdate,
      this.animationEasingUpdate,
      this.animationDelayUpdate});

  factory LinesSeries.fromJson(Map<String, dynamic> json) =>
      _$LinesSeriesFromJson(json);

  Map<String, dynamic> toJson() => _$LinesSeriesToJson(this);
}
